package org.example.tinyurl.entity;

import java.io.Serializable;

/**
 * @author: zk
 * @date: 2023/6/20 22:34
 */
public class RpcResult<T> implements Serializable {
    // 是否成功
    private boolean flag;
    // 返回码
    private Integer code;
    // 返回消息
    private String message;
    // 返回数据
    private T data;

    public RpcResult() {
    }

    public RpcResult(boolean flag, ResultStatus resultStatus, T data) {
        this.flag = flag;
        this.code = resultStatus.getCode();
        this.message = resultStatus.getMessage();
        this.data = data;
    }

    public boolean isFlag() {
        return flag;
    }

    public void setFlag(boolean flag) {
        this.flag = flag;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
